import './public/index'
import { base } from './data/url'

/* 公告 */
notice()
function notice() {
  let speed        =50; 
  let scroll_begin = document.getElementById("notice-start"); 
  let scroll_end   = document.getElementById("notice-end"); 
  let scroll_div   = document.getElementById("notice-value"); 
  let MyMar        =setInterval(Marquee,speed); 

  scroll_end.innerHTML = scroll_begin.innerHTML; 
  
  function Marquee(){ 
    if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0) {scroll_div.scrollLeft-=scroll_begin.offsetWidth; }
    else{ scroll_div.scrollLeft++;}
  } 
  
  scroll_div.onmouseover = function() {clearInterval(MyMar);} 
  scroll_div.onmouseout  = function() {MyMar=setInterval(Marquee,speed);} 
}
/* /公告 */

/* tab */
tab()
function tab() {

  $(document).on('click', '.help-side-item', (e) => {
    e.preventDefault()

    let $el = $(e.target),
        $p  = $el.parents('.help-container'),
        $c  = $p.find('.help-contents-item')

    if (!($el.hasClass('help-side-item'))) {
      $el = $el.parents('.news-tabs-item')
    }

    $el
      .addClass('active')
      .siblings()
      .removeClass('active')

    $c
      .eq($el.index())
      .addClass('active')
      .siblings()
      .removeClass('active')

  })

}
/* /tab */